package garden {
	import mx.collections.ArrayCollection;
	import org.davekeen.flextrine.orm.FlextrineError;
	
	[Bindable]
	public class GardenEntityBase {
		
		[Transient]
		public var __isUnserialized__:Boolean;
		
		[Transient]
		public var __isInitialized__:Boolean = true;
		
		[Transient]
		public var __isCollectionInitializedMap__:Object = new Object();
		
		[Id]
		public var id:String;
		
		public function get name():String { checkIsInitialized("name"); return _name; }
		public function set name(value:String):void { _name = value; }
		private var _name:String;
		
		[Association]
		public function get trees():ArrayCollection { checkIsInitialized("trees"); return _trees; }
		public function set trees(value:ArrayCollection):void { _trees = value; }
		private var _trees:ArrayCollection;
		
		[Association]
		public function get flowers():ArrayCollection { checkIsInitialized("flowers"); return _flowers; }
		public function set flowers(value:ArrayCollection):void { _flowers = value; }
		private var _flowers:ArrayCollection;
		
		public function GardenEntityBase() {
			trees = new ArrayCollection();
			flowers = new ArrayCollection();
		}
		
		public function toString():String {
			return "[Garden id=" + id + "]";
		}
		
		private function checkIsInitialized(property:String):void {
			if (!__isInitialized__ && __isUnserialized__)
				throw new FlextrineError("Attempt to get property '" + property + "' on unitialized Garden.  Consider using EntityManager::require or eager loading.", FlextrineError.ACCESSED_UNITIALIZED_ENTITY);
		}
		
	}

}
